<?php include('header.php'); ?>
<?php include($include); ?>
<?php include('menu.php'); ?>
<script type="text/javascript">
    $(function() {
        // Tabs
        $('#tabs').tabs();
    });
</script>
<article id="address">
    <form >
        <h1>Thông tin người thanh toán</h1>
       
        <p>
            <label for="billFName">Họ và tên lót:</label>
            <input id="billFName" name="billFName" type="text" required="true" value=" <?php echo $diachi[0]->ho_tendem; ?> "><span class="alert">*</span>
        </p>
        <p>
            <label for="billLName">Tên:</label>
            <input id="billLName" name="billLName" type="text" required="true" value=" <?php echo $diachi[0]->ten; ?> "><span class="alert">*</span>
        </p>
        <p>
            <label for="billAddress1">Số nhà / Tên đường:</label>
            <input id="billAddress1" name="billAddress1" type="text" required="true" value=" <?php echo $diachi[0]->sonha_tenduong; ?> "><span class="alert">*</span>
        </p>
        <p>
            <label for="billAddress2">Phường / Xã</label>
            <input id="billAddress2" name="billAddress2" type="text" value=" <?php echo $diachi[0]->phuong_xa; ?> ">
        </p>
        <p>
            <label for="billAddress3">Quận / Huyện:</label>
            <input id="billAddress3" name="billAddress3" type="text" required="true" value=" <?php echo $diachi[0]->quan_huyen; ?> "><span class="alert">*</span>
        </p>
        <p>
            <label for="billCity">Tỉnh / Thành phố:</label>
            <select id="billCity" name="billCountry" onchange="javascript:startDisplay();" required="true">
                <option value="HCM">Hồ Chí Minh</option>
                <option value="HN">Hà Nội</option>
                <option value="QNG">Quảng Ngãi</option>
                <option value="QT">Quảng Trị</option>
                <option value="BT">Bến Tre</option>

            </select>
        </p>
        <p>
            <label for="billZip">Mã bưu chính:</label>
            <input id="billZip" name="billZip" type="text" required="true" value=" <?php echo $diachi[0]->ma_buuchinh; ?> "><span class="alert">*</span>
        </p>
        <p>
            <a id="billEqualShip">Địa chỉ thanh toán là địa chỉ giao hàng</a>
            <input name="billEqualShip" type="checkbox" id="billEqualShip" value="Y" >
        </p>
        <p>
            <label for="email">Email:</label>
            <input id="email" name="email" type="email" required="true" value=" <?php echo $diachi[0]->email; ?> "><span class="alert">*</span>
        </p>
        <p>
            <label for="phone">Số điện thoại:</label>
            <span style="display: none;" class="helper">Please enter your <strong>phone number</strong>.<br>We might need to contact you with regards to your order.</span>
            <input id="phone" name="phone" type="tel" required="true" value=" <?php echo $diachi[0]->sdt; ?> " ><span class="alert">*</span>
        </p>
    </form>
    <form id="ship" method="POST" action="<?php echo base_url('index.php/thanhtoan'); ?>">
        <h1>Địa chỉ giao hàng</h1>
        <p>
            <label for="shipFName">Họ và tên lót:</label>
            <input name="shipFName" type="text" id="shipFName" required="true"><span class="alert">*</span>
        </p>
        <p>
            <label for="shipLName">Tên:</label>
            <input id="shipLName" type="text" name="shipLName" required="true"><span class="alert">*</span>
        </p>
        <p>
            <label for="shipAddress1">Số nhà / Tên đường:</label>
            <input name="shipAddress1" type="text" id="shipAddress1" required="true"><span class="alert">*</span>
        </p>
        <p>
            <label for="shipAddress2">Phường / Xã</label>
            <input name="shipAddress2" type="text" id="shipAddress2">
        </p>
        <p>
            <label for="shipAddress3">Quận / Huyện</label>
            <input name="shipAddress3" type="text" id="shipAddress3" required="true"><span class="alert">*</span>
        </p>
        <p>
            <label for="shipCity">Tỉnh / Thành phố:</label>
            <select id="shipCity" name="shipCity" onchange="javascript:startDisplay();" required="true">
                <option value="HCM">Hồ Chí Minh</option>
                <option value="HN">Hà Nội</option>
                <option value="QNG">Quảng Ngãi</option>
                <option value="QT">Quảng Trị</option>
                <option value="BT">Bến Tre</option>
            </select>
        </p>
        <p>
            <label for="shipZip">Mã bưu chính:</label>
            <input name="shipZip" type="text" id="shipZip" required="true"><span class="alert">*</span></p>	
        <p>
            <label for="phone_bill">Số điện thoại:</label>
            <span style="display: none;" class="helper">Please enter your <strong>phone number</strong>.<br>We might need to contact you with regards to your order.</span>
            <input id="phone_bill" name="phone_bill" type="tel" required="true" ><span class="alert">*</span>
        </p>
        <div id="tabs">
            <ul>
                <input type="radio" name="thanhtoan" value="Thông qua bảo kim"> Thanh toán thông qua bảo kim<br>
                <input type="radio" name="thanhtoan" value="Thanh toán khi giao hàng" checked>Thanh toán khi giao hàng<br>
            </ul>
            <section id="tabs-1">
                <p>Thanh toán sẽ hoàn thành trong khoảng từ 10 phút đến 24 giờ.</p>
                <center><button type="submit" class="continue">Thực hiện</button></center>
            </section>
             <input name="phidv"  type="text" value="<?php echo $phi; ?>" hidden>
        </div>
    </form>

    <p>
        <button type="button">Quay lại</button>
    </p>
</article>
<script>
    $("input[name=billEqualShip]").change(function() {
        var check = $(this).attr('checked');
        if (check == true)
        {
            $("input[name=shipFName]").val($("input[name=billFName]").val());
            $("input[name=shipLName]").val($("input[name=billLName]").val());
            $("input[name=shipAddress1]").val($("input[name=billAddress1]").val());
            $("input[name=shipAddress2]").val($("input[name=billAddress2]").val());
            $("input[name=shipAddress3]").val($("input[name=billAddress3]").val());
            $("input[name=shipZip]").val($("input[name=billZip]").val());
            $("input[name=phone_bill]").val($("input[name=phone]").val());
        }
        else
        {
            $("input[name=shipFName]").val("");

            $("input[name=shipLName]").val('');
            $("input[name=shipAddress1]").val('');
            $("input[name=shipAddress2]").val('');
            $("input[name=shipAddress3]").val('');
            $("input[name=shipZip]").val('');
            $("input[name=phone_bill]").val('');
        }
    });
</script>
<div class="clear"></div>
<?php include('footer.php'); ?>